<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noodp" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
        <title>Markdown PlantUML - aymwoo</title><meta name="Description" content=""><meta property="og:title" content="Markdown PlantUML" />
<meta property="og:description" content="Markdown搭配PlantUML画各种图 PlantUML的安装 包管理工具安装 PlantUML的运行需要Java环境,如果是用pacman" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://aymwoo.gitee.io/posts/markdown-plantuml/" /><meta property="article:section" content="posts" />
<meta property="article:published_time" content="2022-01-14T14:03:26+08:00" />
<meta property="article:modified_time" content="2022-01-14T14:03:26+08:00" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Markdown PlantUML"/>
<meta name="twitter:description" content="Markdown搭配PlantUML画各种图 PlantUML的安装 包管理工具安装 PlantUML的运行需要Java环境,如果是用pacman"/>
<meta name="application-name" content="aymwoo">
<meta name="apple-mobile-web-app-title" content="aymwoo"><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
        <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="manifest" href="/site.webmanifest"><link rel="canonical" href="http://aymwoo.gitee.io/posts/markdown-plantuml/" /><link rel="prev" href="http://aymwoo.gitee.io/posts/rustdesk/" /><link rel="next" href="http://aymwoo.gitee.io/posts/fish-add-path/" /><link rel="stylesheet" href="/lib/normalize/normalize.min.css"><link rel="stylesheet" href="/css/style.min.css"><link rel="stylesheet" href="/lib/fontawesome-free/all.min.css"><link rel="stylesheet" href="/lib/animate/animate.min.css"><script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "headline": "Markdown PlantUML",
        "inLanguage": "zh-CN",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "http:\/\/aymwoo.gitee.io\/posts\/markdown-plantuml\/"
        },"genre": "posts","keywords": "markdown, PlantUML","wordcount":  579 ,
        "url": "http:\/\/aymwoo.gitee.io\/posts\/markdown-plantuml\/","datePublished": "2022-01-14T14:03:26+08:00","dateModified": "2022-01-14T14:03:26+08:00","publisher": {
            "@type": "Organization",
            "name": "wuxf"},"author": {
                "@type": "Person",
                "name": "wuxf"
            },"description": ""
    }
    </script></head>
    <body header-desktop="" header-mobile=""><script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>

        <div id="mask"></div><div class="wrapper"><header class="desktop" id="header-desktop">
    <div class="header-wrapper">
        <div class="header-title">
            <a href="/" title="aymwoo">aymwoo</a>
        </div>
        <div class="menu">
            <div class="menu-inner"><a class="menu-item" href="/posts/"> 文章 </a><a class="menu-item" href="/tags/"> 标签 </a><a class="menu-item" href="/categories/"> 分类 </a><span class="menu-item delimiter"></span><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                    <i class="fas fa-adjust fa-fw"></i>
                </a>
            </div>
        </div>
    </div>
</header><header class="mobile" id="header-mobile">
    <div class="header-container">
        <div class="header-wrapper">
            <div class="header-title">
                <a href="/" title="aymwoo">aymwoo</a>
            </div>
            <div class="menu-toggle" id="menu-toggle-mobile">
                <span></span><span></span><span></span>
            </div>
        </div>
        <div class="menu" id="menu-mobile"><a class="menu-item" href="/posts/" title="">文章</a><a class="menu-item" href="/tags/" title="">标签</a><a class="menu-item" href="/categories/" title="">分类</a><a href="javascript:void(0);" class="menu-item theme-switch" title="切换主题">
                <i class="fas fa-adjust fa-fw"></i>
            </a></div>
    </div>
</header>
<div class="search-dropdown desktop">
    <div id="search-dropdown-desktop"></div>
</div>
<div class="search-dropdown mobile">
    <div id="search-dropdown-mobile"></div>
</div>
<main class="main">
                <div class="container"><div class="toc" id="toc-auto">
            <h2 class="toc-title">目录</h2>
            <div class="toc-content" id="toc-content-auto"></div>
        </div><article class="page single"><h1 class="single-title animated flipInX">Markdown PlantUML</h1><div class="post-meta">
            <div class="post-meta-line"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>wuxf</a></span></div>
            <div class="post-meta-line"><i class="far fa-calendar-alt fa-fw"></i>&nbsp;<time datetime="2022-01-14">2022-01-14</time>&nbsp;<i class="fas fa-pencil-alt fa-fw"></i>&nbsp;约 579 字&nbsp;
                <i class="far fa-clock fa-fw"></i>&nbsp;预计阅读 2 分钟&nbsp;</div>
        </div><div class="details toc" id="toc-static"  kept="">
                <div class="details-summary toc-title">
                    <span>目录</span>
                    <span><i class="details-icon fas fa-angle-right"></i></span>
                </div>
                <div class="details-content toc-content" id="toc-content-static"><nav id="TableOfContents">
  <ul>
    <li><a href="#plantuml的安装">PlantUML的安装</a>
      <ul>
        <li><a href="#包管理工具安装">包管理工具安装</a></li>
        <li><a href="#手动安装">手动安装</a></li>
      </ul>
    </li>
    <li><a href="#在markdown中使用plantuml绘图">在Markdown中使用PlantUML绘图</a>
      <ul>
        <li><a href="#流程图">流程图</a></li>
        <li><a href="#时序图">时序图</a></li>
        <li><a href="#思维导图">思维导图</a></li>
        <li><a href="#组织结构图">组织结构图</a></li>
        <li><a href="#其他图形">其他图形</a></li>
      </ul>
    </li>
  </ul>
</nav></div>
            </div><div class="content" id="content"><h1 id="markdown搭配plantuml画各种图">Markdown搭配PlantUML画各种图</h1>
<h2 id="plantuml的安装">PlantUML的安装</h2>
<h3 id="包管理工具安装">包管理工具安装</h3>
<p>PlantUML的运行需要Java环境,如果是用pacman之类的包管理工具安装,会自动安装jre.</p>
<pre tabindex="0"><code>#pacman -S plantuml
</code></pre><p>如果需要绘制时序图和活动图之外的图,还需要安装graphviz软件.</p>
<pre tabindex="0"><code>#pacman -S graphviz
</code></pre><h3 id="手动安装">手动安装</h3>
<ol>
<li>下载<a href="http://sourceforge.net/projects/plantuml/files/plantuml.jar/download" target="_blank" rel="noopener noreffer">plantuml.jar</a>文件,保存到本地目录.</li>
<li>用PlantUML书写你的文本文件.</li>
<li>用plantuml将你的PlantUML文件输出为图像,如:</li>
</ol>
<pre tabindex="0"><code>java -jar plantuml.jar demo.txt
</code></pre><p>此时你将得到一个demo.png的图片.</p>
<h2 id="在markdown中使用plantuml绘图">在Markdown中使用PlantUML绘图</h2>
<p><a href="https://plantuml.com/zh/sequence-diagram" target="_blank" rel="noopener noreffer">官网文档</a>详细说明了PlantUML支持的各种图的语法.</p>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="docs.png"
        data-srcset="docs.png, docs.png 1.5x, docs.png 2x"
        data-sizes="auto"
        alt="docs.png"
        title="docs" /></p>
<h3 id="流程图">流程图</h3>
<pre tabindex="0"><code>@startuml
(*) --&gt; &quot;Initialization&quot;

if &quot;Some Test&quot; then
  --&gt;[true] &quot;Some Activity&quot;
  --&gt; &quot;Another activity&quot;
  -right-&gt; (*)
else
  -&gt;[false] &quot;Something else&quot;
  --&gt;[Ending process] (*)
endif

@enduml
</code></pre>

  




<figure>
  <img
    src='https://g.gravizo.com/svg?%0a%40startuml%0a%28%2a%29%20--%3e%20%22Initialization%22%0a%0aif%20%22Some%20Test%22%20then%0a%20%20--%3e%5btrue%5d%20%22Some%20Activity%22%0a%20%20--%3e%20%22Another%20activity%22%0a%20%20-right-%3e%20%28%2a%29%0aelse%0a%20%20-%3e%5bfalse%5d%20%22Something%20else%22%0a%20%20--%3e%5bEnding%20process%5d%20%28%2a%29%0aendif%0a%40enduml%0a'
    alt='Diagram'
    />
    <figcaption>Diagram</figcaption>
</figure>

<h3 id="时序图">时序图</h3>
<pre tabindex="0"><code>@startuml
== Initialization ==
Alice -&gt; Bob: : Can you solve: &lt;math&gt;ax^2+bx+c=0&lt;/math&gt;
Bob --&gt; Alice: &lt;math&gt;x = (-b+-sqrt(b^2-4ac))/(2a)&lt;/math&gt;
activate Alice #FFBBBB
note left: this is a first note

Alice -&gt; Bob: Another dialogue
deactivate Alice

Alice &lt;-- Bob: Another dialogue

@enduml
</code></pre>

  




<figure>
  <img
    src='https://g.gravizo.com/svg?%0a%40startuml%0a%0a%3d%3d%20Initialization%20%3d%3d%0a%0aAlice%20-%3e%20Bob%3a%20%3a%20Can%20you%20solve%3a%20%3cmath%3eax%5e2%2bbx%2bc%3d0%3c%2fmath%3e%0aBob%20--%3e%20Alice%3a%20%3cmath%3ex%20%3d%20%28-b%2b-sqrt%28b%5e2-4ac%29%29%2f%282a%29%3c%2fmath%3e%0aactivate%20Alice%20%23FFBBBB%0anote%20left%3a%20this%20is%20a%20first%20note%0a%0aAlice%20-%3e%20Bob%3a%20Another%20dialogue%0adeactivate%20Alice%0a%0aAlice%20%3c--%20Bob%3a%20Another%20dialogue%0a%0a%40enduml%0a'
    alt='Diagram'
    />
    <figcaption>Diagram</figcaption>
</figure>

<h3 id="思维导图">思维导图</h3>
<p>思维导图还处于测试阶段,语法随时可能修改.</p>
<pre tabindex="0"><code>@startuml
@startmindmap
+ OS
++ Ubuntu
+++ Linux Mint
+++ Kubuntu
+++ Lubuntu
+++ KDE Neon
++ LMDE
++ SolydXK
++ SteamOS
++ Raspbian
-- Windows 95
-- Windows 98
-- Windows NT
--- Windows 8
--- Windows 10
@endmindmap
@enuml

</code></pre><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="mindmap.png"
        data-srcset="mindmap.png, mindmap.png 1.5x, mindmap.png 2x"
        data-sizes="auto"
        alt="mindmap.png"
        title="思维导图" /></p>
<h3 id="组织结构图">组织结构图</h3>
<pre tabindex="0"><code>@startuml
@startwbs
+ New Job
++ Decide on Job Requirements
+++ Identity gaps
+++ Review JDs
++++ Sign-Up for courses
++++ Volunteer
++++ Reading
++- Checklist
+++- Responsibilities
+++- Location
++ CV Upload Done
+++ CV Updated
++++ Spelling &amp; Grammar
++++ Check dates
---- Skills
+++ Recruitment sites chosen
@endwbs
@enduml
</code></pre><p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="wbs.png"
        data-srcset="wbs.png, wbs.png 1.5x, wbs.png 2x"
        data-sizes="auto"
        alt="wbs.png"
        title="组织结构图" /></p>
<h3 id="其他图形">其他图形</h3>
<p>除此之外,PlantUML还支持时序图,用例图,类图,组件图,状态图,对象图,部署图,定时图,Network,Wireframe,Archimate,Gantt等多种图形,具体语法可以查看<a href="https://plantuml.com/zh/sequence-diagram" target="_blank" rel="noopener noreffer">官网文档</a></p>
</div><div class="post-footer" id="post-footer">
    <div class="post-info">
        <div class="post-info-line">
            <div class="post-info-mod">
                <span>更新于 2022-01-14</span>
            </div>
            <div class="post-info-license"></div>
        </div>
        <div class="post-info-line">
            <div class="post-info-md"></div>
            <div class="post-info-share">
                <span></span>
            </div>
        </div>
    </div>

    <div class="post-info-more">
        <section class="post-tags"><i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/markdown/">markdown</a>,&nbsp;<a href="/tags/plantuml/">PlantUML</a></section>
        <section>
            <span><a href="javascript:void(0);" onclick="window.history.back();">返回</a></span>&nbsp;|&nbsp;<span><a href="/">主页</a></span>
        </section>
    </div>

    <div class="post-nav"><a href="/posts/rustdesk/" class="prev" rel="prev" title="RustDesk"><i class="fas fa-angle-left fa-fw"></i>RustDesk</a>
            <a href="/posts/fish-add-path/" class="next" rel="next" title="Fish Add Path">Fish Add Path<i class="fas fa-angle-right fa-fw"></i></a></div>
</div>
</article></div>
            </main></div>

        <div id="fixed-buttons"><a href="#" id="back-to-top" class="fixed-button" title="回到顶部">
                <i class="fas fa-arrow-up fa-fw"></i>
            </a><a href="#" id="view-comments" class="fixed-button" title="查看评论">
                <i class="fas fa-comment fa-fw"></i>
            </a>
        </div><script type="text/javascript" src="/lib/smooth-scroll/smooth-scroll.min.js"></script><script type="text/javascript" src="/lib/lazysizes/lazysizes.min.js"></script><script type="text/javascript" src="/lib/clipboard/clipboard.min.js"></script><script type="text/javascript">window.config={"code":{"copyTitle":"复制到剪贴板","maxShownLines":10},"comment":{}};</script><script type="text/javascript" src="/js/theme.min.js"></script><script>
			var _hmt = _hmt || [];
			(function() {
			  var hm = document.createElement("script");
			  hm.src = "https://hm.baidu.com/hm.js?3508d9f941c446dcf5e14d1e77231e51";
			  var s = document.getElementsByTagName("script")[0]; 
			  s.parentNode.insertBefore(hm, s);
			})();
		</script></body>
</html>
